﻿using System.ComponentModel.DataAnnotations;
using Lbb.Localization;

namespace Lbb.DataAnnotations
{
    /// <summary>
    /// 指定数据字段是电话号码.
    /// </summary>
    /// <author>Chiron</author>
    public class NTelePhoneAttribute : RegularExpressionAttribute
    {
        /// <summary>
        /// 指定数据字段是电话号码.
        /// </summary>
        public NTelePhoneAttribute()
            : base(@"^(\d{3,4}-)?(\d{11})$")
        {
            if (ErrorMessageResourceType == null) ErrorMessageResourceType = typeof(ErrorRes);
            if (string.IsNullOrEmpty(ErrorMessageResourceName)) ErrorMessageResourceName = "RegularTelePhone";
        }
    }
}
